package computer;

public class Computer {
	private String name = "computer";
	private Components cpu = new InterCPU();
	private Harddisk harddisk = new SeagateHarddisk();
	private Memory memory = new SamsungMemory();
	private Mainboard mainboard = new AsusMainboard();
	public int getPrice() {
		return cpu.getPrice() + harddisk.getPrice() 
		+ memory.getPrice() + mainboard.getPrice();
	}
	public void getDescription() {
		System.out.println("Computer " + name + ":");
		System.out.println("CPU: " + cpu.getName());
		System.out.println("Memory: " + memory.getName());
		System.out.println("Harddisk: " + harddisk.getName());
		System.out.println("Mainboard: " + mainboard.getName());
		System.out.println("How they work?");
		cpu.work();
		harddisk.work();
		memory.work();
		mainboard.work();
		System.out.println("This computer costs " + this.getPrice());
		System.out.println("");
	}
	public void setName(String name) {
		this.name = name;
	}
}

